package com.pingtai.util;

import java.util.List;

public class PaginationSupport {
	public final static int PAGESIZE = 20;  
	  
    private int pageSize = PAGESIZE;  
  
    private List items;  
  
    private long totalCount;  
  
    private long[] indexes = new long[0];  
  
    private long startIndex = 0;
    
    private int pageNum;
    
    private long shenheCount;
    
    private long zhixingCount;
    
    private long tuikuanCount;
    
    private long wanchengCount;
    
    private long stateCount4;
    
    private long stateCount5;
    
    private long stateCount6;
    
    private Float totalCosumption;
    private Float totleChongzhiMoney;
    private Float totleKoukuanMoney;
    private Float totlefanliMoney;
    
    
    public Float getTotlefanliMoney() {
		return totlefanliMoney;
	}


	public void setTotlefanliMoney(Float totlefanliMoney) {
		this.totlefanliMoney = totlefanliMoney;
	}


	public Float getTotleChongzhiMoney() {
		return totleChongzhiMoney;
	}


	public void setTotleChongzhiMoney(Float totleChongzhiMoney) {
		this.totleChongzhiMoney = totleChongzhiMoney;
	}


	public Float getTotleKoukuanMoney() {
		return totleKoukuanMoney;
	}


	public void setTotleKoukuanMoney(Float totleKoukuanMoney) {
		this.totleKoukuanMoney = totleKoukuanMoney;
	}


	public Float getTotalCosumption() {
		return totalCosumption;
	}


	public void setTotalCosumption(Float totalCosumption) {
		this.totalCosumption = totalCosumption;
	}


	public long getStateCount4() {
		return stateCount4;
	}


	public void setStateCount4(long stateCount4) {
		this.stateCount4 = stateCount4;
	}


	public long getStateCount5() {
		return stateCount5;
	}


	public void setStateCount5(long stateCount5) {
		this.stateCount5 = stateCount5;
	}


	public long getStateCount6() {
		return stateCount6;
	}


	public void setStateCount6(long stateCount6) {
		this.stateCount6 = stateCount6;
	}


	public PaginationSupport(){
    	
    }
    
  
    public long getShenheCount() {
		return shenheCount;
	}

	public void setShenheCount(long shenheCount) {
		this.shenheCount = shenheCount;
	}

	public long getZhixingCount() {
		return zhixingCount;
	}

	public void setZhixingCount(long zhixingCount) {
		this.zhixingCount = zhixingCount;
	}

	public long getTuikuanCount() {
		return tuikuanCount;
	}

	public void setTuikuanCount(long tuikuanCount) {
		this.tuikuanCount = tuikuanCount;
	}

	public long getWanchengCount() {
		return wanchengCount;
	}

	public void setWanchengCount(long wanchengCount) {
		this.wanchengCount = wanchengCount;
	}

	public static int getPagesize() {
		return PAGESIZE;
	}

	public void setStartIndex(long startIndex) {
		this.startIndex = startIndex;
	}

	public int getPageNum() {
		return pageNum;
	}

	public void setPageNum(int pageNum) {
		this.pageNum = pageNum;
	}

	public PaginationSupport(List items, long totalCount) {  
        setPageSize(PAGESIZE);  
        setTotalCount(totalCount);  
        setItems(items);          
        setStartIndex(0);  
    }  
  
    public PaginationSupport(List items, long totalCount, int startIndex) {  
                setPageSize(PAGESIZE);  
        setTotalCount(totalCount);  
        setItems(items);          
        setStartIndex(startIndex);  
    }  
  
    public PaginationSupport(List items, long totalCount, int pageSize, int startIndex) {  
                setPageSize(pageSize);  
        setTotalCount(totalCount);  
        setItems(items);  
        setStartIndex(startIndex);  
    }  
  
    public List getItems() {  
        return items;  
    }  
  
    public void setItems(List items) {  
        this.items = items;  
    }  
  
    public int getPageSize() {  
        return pageSize;  
    }  
  
    public void setPageSize(int pageSize) {  
        this.pageSize = pageSize;  
    }  
  
    public long getTotalCount() {  
        return totalCount;  
    }  
  
    public void setTotalCount(long totalCount) {  
        if (totalCount > 0) {  
            this.totalCount = totalCount;  
            int count = (int) (totalCount / pageSize);  
            if (totalCount % pageSize > 0)  
                count++;  
            this.pageNum = count;
            indexes = new long[count];  
            for (int i = 0; i < count; i++) {  
                indexes[i] = pageSize * i;  
            }  
        } else {  
            this.totalCount = 0;  
        }  
    }  
  
    public long[] getIndexes() {  
        return indexes;  
    }  
  
    public void setIndexes(long[] indexes) {  
        this.indexes = indexes;  
    }  
  
    public long getStartIndex() {  
        return startIndex;  
    }  
  
    public void setStartIndex(int startIndex) {  
        if (totalCount <= 0)  
            this.startIndex = 0;  
        else if (startIndex >= totalCount)  
            this.startIndex = indexes[indexes.length - 1];  
        else if (startIndex < 0)  
            this.startIndex = 0;  
        else {  
            this.startIndex = indexes[startIndex / pageSize];  
        }  
    }  
  
    public long getNextIndex() {  
    	long nextIndex = getStartIndex() + pageSize;  
        if (nextIndex >= totalCount)  
            return getStartIndex();  
        else  
            return nextIndex;  
    }  
  
    public long getPreviousIndex() {  
    	long previousIndex = getStartIndex() - pageSize;  
        if (previousIndex < 0)  
            return 0;  
        else  
            return previousIndex;  
    }  
}
